<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="jquery-3.5.1.js"></script>
    <script type ="text/javascript">
        $(function (){
            alert($(":checkbox:first").attr("names"));
            }
        )

    </script>

</head>
<body>
    <br/>
    多选：
    <input name="checkbox" type="checkbox" value="checbox1" /> checkbox1
    <input name="checkbox" type="checkbox" value="checbox2" /> checkbox2

</body>
</html>